Product Code Database
Example Keywords: hair -smartphones $87-135
barcode-scavenger
   » » Wiki: Initial Algebra
Tag Wiki 'Initial Algebra'.
Tag

In , an initial algebra is an in the category of for a given . This initiality provides a general framework for induction and .


Examples

Functor
Consider the endofunctor , i.e. sending to , where is a one-point (singleton) set, a in the category. An algebra for this endofunctor is a set (called the carrier of the algebra) together with a function . Defining such a function amounts to defining a point and a function . Define
\begin{align}
 \operatorname{zero} \colon 1 &\longrightarrow\mathbf{N} \\
 * &\longmapsto 0
     
\end{align} and
\begin{align}
 \operatorname{succ}\colon \mathbf{N}&\longrightarrow\mathbf{N} \\
 n &\longmapsto n + 1.
     
\end{align} Then the set of natural numbers together with the function is an initial -algebra. The initiality (the universal property for this case) is not hard to establish; the unique to an arbitrary -algebra , for an element of and a function on , is the function sending the natural number to , that is, , the -fold application of to .

The set of is the carrier of an initial algebra for this functor: the point is zero and the function is the successor function.


Functor
For a second example, consider the endofunctor on the category of sets, where is the set of natural numbers. An algebra for this endofunctor is a set together with a function . To define such a function, we need a point and a function . The set of finite lists of natural numbers is an initial algebra for this functor. The point is the empty list, and the function is , taking a number and a finite list, and returning a new finite list with the number at the head.

In categories with binary , the definitions just given are equivalent to the usual definitions of a natural number object and a , respectively.


Final coalgebra
Dually, a final coalgebra is a in the category of . The finality provides a general framework for and .

For example, using the same as before, a coalgebra is defined as a set together with a function . Defining such a function amounts to defining a whose domain is formed by those x \in X for which does not belong to . Having such a structure, we can define a chain of sets: being a subset of on which is not defined, which elements map into by , which elements map into by , etc., and containing the remaining elements of . With this in view, the set \mathbf{N} \cup \{\omega\}, consisting of the set of natural numbers extended with a new element , is the carrier of the final coalgebra, where f' is the predecessor function (the of the successor function) on the positive naturals, but acts like the identity on the new element : , . This set \mathbf{N} \cup \{\omega\} that is the carrier of the final coalgebra of is known as the set of conatural numbers.

For a second example, consider the same functor as before. In this case the carrier of the final coalgebra consists of all lists of natural numbers, finite as well as . The operations are a test function testing whether a list is empty, and a deconstruction function defined on non-empty lists returning a pair consisting of the head and the tail of the input list.


Theorems
  • Initial algebras are minimal (i.e., have no proper subalgebra).
  • Final coalgebras are (i.e., have no proper quotients).


Use in computer science
Various finite used in programming, such as lists and trees, can be obtained as initial algebras of specific endofunctors. While there may be several initial algebras for a given endofunctor, they are unique , which informally means that the "observable" properties of a data structure can be adequately captured by defining it as an initial algebra.

To obtain the of lists whose elements are members of set , consider that the list-forming operations are:

  • \mathrm{nil}\colon 1 \to \mathrm{List}(A)
  • \mathrm{cons}\colon A \times \mathrm{List}(A) \to \mathrm{List}(A)

Combined into one function, they give:

  • \mathrm{nil},\mathrm{cons}\colon (1 + A \times \mathrm{List}(A))\to \mathrm{List}(A),

which makes this an -algebra for the endofunctor sending to . It is, in fact, the initial -algebra. Initiality is established by the function known as foldr in functional programming languages such as Haskell and ML.

Likewise, with elements at the leaves can be obtained as the initial algebra

  • \mathrm{tip},\mathrm{join}\colon A + (\mathrm{Tree}(A) \times \mathrm{Tree}(A)) \to \mathrm{Tree}(A).

Types obtained this way are known as algebraic data types.

Types defined by using least fixed point construct with functor can be regarded as an initial -algebra, provided that holds for the type.Philip Wadler: Recursive types for free! University of Glasgow, July 1990. Draft.

In a dual way, similar relationship exists between notions of greatest fixed point and terminal -coalgebra, with applications to types. These can be used for allowing objects while maintaining strong normalization property. In the strongly normalizing (each program terminates) Charity programming language, coinductive data types can be used for achieving surprising results, e.g. defining constructs to implement such “strong” functions like the Ackermann function.: Charitable Thoughts ( ps.gz)


See also


Notes


External links

Page 1 of 1
1
Page 1 of 1
1

Account

Social:
Pages:  ..   .. 
Items:  .. 

Navigation

General: Atom Feed Atom Feed  .. 
Help:  ..   .. 
Category:  ..   .. 
Media:  ..   .. 
Posts:  ..   ..   .. 

Statistics

Page:  .. 
Summary:  .. 
1 Tags
10/10 Page Rank
5 Page Refs